package br.com.eventime.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import br.com.eventime.component.BaseEntity;

/**
 * The persistent class for the ramo database table.
 * 
 */
@Entity
@NamedQueries({
		@NamedQuery(name = "Ramo.findByCodeOrDesc", query = "SELECT r FROM Ramo AS r WHERE r.codigo = :codigo OR r.descricao LIKE :descricao ORDER BY r.codigo"),
		@NamedQuery(name = "Ramo.findAll", query = "SELECT r FROM Ramo AS r ORDER BY r.codigo") })
public class Ramo  implements Serializable,BaseEntity<Integer> {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer codigo;

	@Temporal(TemporalType.DATE)
	@Column(name = "data_alteracao")
	private Date dataAlteracao;

	@Temporal(TemporalType.DATE)
	@Column(name = "data_inclusao")
	private Date dataInclusao;

	private String descricao;

	private String situacao;

	// uni-directional many-to-one association to Usuario
	@ManyToOne
	@JoinColumn(name = "usuario_inclusao")
	private Usuario usuarioInclusao;

	// uni-directional many-to-one association to Usuario
	@ManyToOne
	@JoinColumn(name = "usuario_alteracao")
	private Usuario usuarioAlteracao;

	public Ramo() {
	}

	public Integer getCodigo() {
		return this.codigo;
	}

	public void setCodigo(Integer codigo) {
		this.codigo = codigo;
	}

	public Date getDataAlteracao() {
		return this.dataAlteracao;
	}

	public void setDataAlteracao(Date dataAlteracao) {
		this.dataAlteracao = dataAlteracao;
	}

	public Date getDataInclusao() {
		return this.dataInclusao;
	}

	public void setDataInclusao(Date dataInclusao) {
		this.dataInclusao = dataInclusao;
	}

	public String getDescricao() {
		return this.descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public String getSituacao() {
		return this.situacao;
	}

	public void setSituacao(String situacao) {
		this.situacao = situacao;
	}

	public Usuario getUsuarioInclusao() {
		return this.usuarioInclusao;
	}

	public void setUsuarioInclusao(Usuario usuarioInclusao) {
		this.usuarioInclusao = usuarioInclusao;
	}

	public Usuario getUsuarioAlteracao() {
		return this.usuarioAlteracao;
	}

	public void setUsuarioAlteracao(Usuario usuarioAlteracao) {
		this.usuarioAlteracao = usuarioAlteracao;
	}

	@Override
	public boolean equals(Object object){
		if(object instanceof Integer){
			Integer obj = (Integer) object;
			return obj == codigo;
		}
		return false;
	}

	@Override
	@Transient
	public Integer getIdentificador() {
		return getCodigo();
	}

	
	
}